package com.zhangdi.dwdata.repository;

import com.zhangdi.dwdata.page.Page;
import com.zhangdi.dwdata.query.Filter;
import com.zhangdi.dwdata.query.Finder;
import com.zhangdi.dwdata.query.Order;
import com.zhangdi.dwdata.query.QFinder;

import javax.persistence.TypedQuery;
import javax.persistence.criteria.CriteriaQuery;
import java.util.List;

/**
 * Created by zhangdi on 2020/09/24 11:52:41.
 */
public interface BaseRepository<T> {
    T getOne(QFinder q);

    T getOne(String property, Object val);

    List<T> query(List<Filter> filters);

    List<T> query(List<Filter> filters, List<Order> orders);

    List<T> query(String property, Object val);

    List<T> query(QFinder q);

    Page<T> query(QFinder q, int pageNo, int pageSize);

    TypedQuery<T> createQuery(QFinder q);

    Long totalCountQuery(QFinder q);

    CriteriaQuery<T> createQuery(Finder<T> finder);

    CriteriaQuery<T> createQueryByOrder(Finder<T> finder);
}
